From 1a7cc0a83c0e106e2248acaf13810a6e0ebc9d31 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 19 Apr 2006 18:32:20 +0100 Subject: [PATCH] Replace &foo[0] with foo where the latter seems cleaner (which is usually, and particularly when its an argument to one of the bitops functions). Signed-off-by: Keir Fraser --- xen/arch/x86/domain_build.c | 4 ++-- xen/arch/x86/irq.c | 20 ++++++++++---------- xen/arch/x86/shadow_public.c | 2 +- xen/common/event_channel.c | 8 ++++---- xen/common/keyhandler.c | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c index 599753a613..6b38f6f052 100644 --- a/xen/arch/x86/domain_build.c +++ b/xen/arch/x86/domain_build.c @@ -443,7 +443,7 @@ int construct_dom0(struct domain *d, v->arch.guest_table = mk_pagetable((unsigned long)l3start); #else l2start = l2tab = (l2_pgentry_t *)mpt_alloc; mpt_alloc += PAGE_SIZE; - memcpy(l2tab, &idle_pg_table[0], PAGE_SIZE); + memcpy(l2tab, idle_pg_table, PAGE_SIZE); l2tab[LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT] = l2e_from_paddr((unsigned long)l2start, __PAGE_HYPERVISOR); v->arch.guest_table = mk_pagetable((unsigned long)l2start); @@ -569,7 +569,7 @@ int construct_dom0(struct domain *d, /* WARNING: The new domain must have its 'processor' field filled in! */ maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l4_page_table; l4start = l4tab = __va(mpt_alloc); mpt_alloc += PAGE_SIZE; - memcpy(l4tab, &idle_pg_table[0], PAGE_SIZE); + memcpy(l4tab, idle_pg_table, PAGE_SIZE); l4tab[l4_table_offset(LINEAR_PT_VIRT_START)] = l4e_from_paddr(__pa(l4start), __PAGE_HYPERVISOR); l4tab[l4_table_offset(PERDOMAIN_VIRT_START)] = diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 2c752fd0ee..41bfb98e7e 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -198,7 +198,7 @@ static void __do_IRQ_guest(int vector) { d = action->guest[i]; if ( (action->ack_type != ACKTYPE_NONE) && - !test_and_set_bit(irq, &d->pirq_mask[0]) ) + !test_and_set_bit(irq, d->pirq_mask) ) action->in_flight++; send_guest_pirq(d, irq); } @@ -285,7 +285,7 @@ static void flush_all_pending_eoi(void *unused) ASSERT(action->ack_type == ACKTYPE_EOI); ASSERT(desc->status & IRQ_GUEST); for ( i = 0; i < action->nr_guests; i++ ) - clear_bit(vector_to_irq(vector), &action->guest[i]->pirq_mask[0]); + clear_bit(vector_to_irq(vector), action->guest[i]->pirq_mask); action->in_flight = 0; spin_unlock(&desc->lock); } @@ -310,8 +310,8 @@ int pirq_guest_unmask(struct domain *d) spin_lock_irq(&desc->lock); - if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) && - test_and_clear_bit(pirq, &d->pirq_mask[0]) ) + if ( !test_bit(d->pirq_to_evtchn[pirq], s->evtchn_mask) && + test_and_clear_bit(pirq, d->pirq_mask) ) { ASSERT(action->ack_type != ACKTYPE_NONE); if ( --action->in_flight == 0 ) @@ -493,13 +493,13 @@ int pirq_guest_unbind(struct domain *d, int irq) switch ( action->ack_type ) { case ACKTYPE_UNMASK: - if ( test_and_clear_bit(irq, &d->pirq_mask[0]) && + if ( test_and_clear_bit(irq, d->pirq_mask) && (--action->in_flight == 0) ) desc->handler->end(vector); break; case ACKTYPE_EOI: /* NB. If #guests == 0 then we clear the eoi_map later on. */ - if ( test_and_clear_bit(irq, &d->pirq_mask[0]) && + if ( test_and_clear_bit(irq, d->pirq_mask) && (--action->in_flight == 0) && (action->nr_guests != 0) ) { @@ -511,7 +511,7 @@ int pirq_guest_unbind(struct domain *d, int irq) break; } - BUG_ON(test_bit(irq, &d->pirq_mask[0])); + BUG_ON(test_bit(irq, d->pirq_mask)); if ( action->nr_guests != 0 ) goto out; @@ -587,16 +587,16 @@ static void dump_irqs(unsigned char key) printk("%u(%c%c%c%c)", d->domain_id, (test_bit(d->pirq_to_evtchn[irq], - &d->shared_info->evtchn_pending[0]) ? + d->shared_info->evtchn_pending) ? 'P' : '-'), (test_bit(d->pirq_to_evtchn[irq]/BITS_PER_LONG, &d->shared_info->vcpu_info[0]. evtchn_pending_sel) ? 'S' : '-'), (test_bit(d->pirq_to_evtchn[irq], - &d->shared_info->evtchn_mask[0]) ? + d->shared_info->evtchn_mask) ? 'M' : '-'), - (test_bit(irq, &d->pirq_mask) ? + (test_bit(irq, d->pirq_mask) ? 'M' : '-')); if ( i != action->nr_guests ) printk(","); diff --git a/xen/arch/x86/shadow_public.c b/xen/arch/x86/shadow_public.c index cb864f9510..6216940244 100644 --- a/xen/arch/x86/shadow_public.c +++ b/xen/arch/x86/shadow_public.c @@ -327,7 +327,7 @@ static void alloc_monitor_pagetable(struct vcpu *v) mmfn = page_to_mfn(mmfn_info); mpl4e = (l4_pgentry_t *) map_domain_page_global(mmfn); - memcpy(mpl4e, &idle_pg_table[0], PAGE_SIZE); + memcpy(mpl4e, idle_pg_table, PAGE_SIZE); mpl4e[l4_table_offset(PERDOMAIN_VIRT_START)] = l4e_from_paddr(__pa(d->arch.mm_perdomain_l3), __PAGE_HYPERVISOR); diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index a217e1be8b..66ba992308 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -477,10 +477,10 @@ void evtchn_set_pending(struct vcpu *v, int port) * others may require explicit memory barriers. */ - if ( test_and_set_bit(port, &s->evtchn_pending[0]) ) + if ( test_and_set_bit(port, s->evtchn_pending) ) return; - if ( !test_bit (port, &s->evtchn_mask[0]) && + if ( !test_bit (port, s->evtchn_mask) && !test_and_set_bit(port / BITS_PER_LONG, &v->vcpu_info->evtchn_pending_sel) && !test_and_set_bit(0, &v->vcpu_info->evtchn_upcall_pending) ) @@ -668,8 +668,8 @@ static long evtchn_unmask(evtchn_unmask_t *unmask) * These operations must happen in strict order. Based on * include/xen/event.h:evtchn_set_pending(). */ - if ( test_and_clear_bit(port, &s->evtchn_mask[0]) && - test_bit (port, &s->evtchn_pending[0]) && + if ( test_and_clear_bit(port, s->evtchn_mask) && + test_bit (port, s->evtchn_pending) && !test_and_set_bit (port / BITS_PER_LONG, &v->vcpu_info->evtchn_pending_sel) && !test_and_set_bit (0, &v->vcpu_info->evtchn_upcall_pending) ) diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index f881412ec7..a80de73840 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -157,9 +157,9 @@ static void dump_domains(unsigned char key) printk(" Notifying guest (virq %d, port %d, stat %d/%d/%d)\n", VIRQ_DEBUG, v->virq_to_evtchn[VIRQ_DEBUG], test_bit(v->virq_to_evtchn[VIRQ_DEBUG], - &d->shared_info->evtchn_pending[0]), + d->shared_info->evtchn_pending), test_bit(v->virq_to_evtchn[VIRQ_DEBUG], - &d->shared_info->evtchn_mask[0]), + d->shared_info->evtchn_mask), test_bit(v->virq_to_evtchn[VIRQ_DEBUG]/BITS_PER_LONG, &v->vcpu_info->evtchn_pending_sel)); send_guest_vcpu_virq(v, VIRQ_DEBUG); -- 2.30.2